using System;
using System.Collections.Generic;
using System.Text;
using PH.Mission;
using System.Drawing;
using PH.Common;
using Hoshimi._Utilitaire_;

namespace Hoshimi
{
	public class MyUniqueNavigationObjective : BaseNavigationObjective
	{
		protected UniqueNavigationObjective mObjective = null;

		public override BaseObjective myObjective 
		{ 
			get { return this.mObjective;} 
			set { this.mObjective = (UniqueNavigationObjective) value;} 
		}

		public override bool IsUniqueNavigationObjective { get { return true; }}

		public override NanoBotType GetObjectiveBotType()
		{
			return this.mObjective.NanoBotType;
		}

		public override void FillNavPointList()
		{
			foreach(NavPoint navPoint in this.mObjective.NavPoints)
			{
				if(	navPoint.EndTurn < Config.NbTurnInTheGame ||
					navPoint.StartTurn > 0)
				{
					this.mHasConstraints = true;
				}

				if (navPoint.Stock > 0)
				{
					this.mHasStockConstraint = true;
				}

				this.AddNavigationLocation(new NavPointContainer(navPoint));
			}
		}

		public static NanoBotType GetNanoBotTypeNeeded(UniqueNavigationObjective objective)
		{
			bool hasStockConstraint = false;

			foreach(NavPoint navPoint in objective.NavPoints)
			{
				if (navPoint.Stock > 0)
				{
					hasStockConstraint = true;
				}
			}

			if (!hasStockConstraint)
			{
				return objective.NanoBotType;
			}

			if (objective.NanoBotType != NanoBotType.Unknown)
			{
				return objective.NanoBotType;
			}

			return NanoBotType.NanoCollector;
		}

		public MyUniqueNavigationObjective(UniqueNavigationObjective objective, int id)
			: base(objective, id)
		{

		}
	}
}
